Passed
Push — master ( 772c18...ea9505 )
by Rafael S.
02:00
created

read-64bit.js ➔ describe(ꞌ64-bit readingꞌ)   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 62

Duplication

Lines 62
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 1
nop 0
dl 62
loc 62
rs 9.4743
c 1
b 0
f 0

13 Functions

Rating   Name   Duplication   Size   Complexity  
A read-64bit.js ➔ ... ➔ it(ꞌsamples.length should be > 0ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌsubChunk2Id should be ꞌdataꞌꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌformat should be ꞌWAVEꞌꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌsubChunk1Size should be 16ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌbyteRate should be 384000ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌbitsPerSample should be 64ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌsubChunk2Size should be > 0ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌblockAlign should be 8ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌnumChannels should be 1ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌsubChunk1Id should be ꞌfmt ꞌꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌsampleRate should be 48000ꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌchunkId should be ꞌRIFFꞌꞌ) 3 3 1
A read-64bit.js ➔ ... ➔ it(ꞌaudioFormat should be 3 (IEEE)ꞌ) 3 3 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/*!
2
 * Copyright (c) 2017 Rafael da Silva Rocha.
3
 * 
4
 */
5
6 View Code Duplication
let assert = require("assert");
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7
8
describe("64-bit reading", function() {
9
10
    let fs = require("fs");
11
    let wavefile = require("../index.js");
12
    let path = "test/files/";
13
    
14
    let wBytes = fs.readFileSync(path + "64bit-48kHz-noBext-mono.wav");
15
    let wav = new wavefile.WaveFile(wBytes);
16
17
    it("chunkId should be 'RIFF'",
18
            function() {
19
        assert.equal(wav.chunkId, "RIFF");
20
    });
21
    it("subChunk1Id should be 'fmt '",
22
            function() {
23
        assert.equal(wav.subChunk1Id, "fmt ");
24
    });
25
    it("format should be 'WAVE'",
26
            function() {
27
        assert.equal(wav.format, "WAVE");
28
    });
29
    it("subChunk1Size should be 16",
30
            function() {
31
        assert.equal(wav.subChunk1Size, 16);
32
    });
33
    it("audioFormat should be 3 (IEEE)",
34
            function() {
35
        assert.equal(wav.audioFormat, 3);
36
    });
37
    it("numChannels should be 1",
38
            function() {
39
        assert.equal(wav.numChannels, 1);
40
    });
41
    it("sampleRate should be 48000",
42
            function() {
43
        assert.equal(wav.sampleRate, 48000);
44
    });
45
    it("byteRate should be 384000",
46
            function() {
47
        assert.equal(wav.byteRate, 384000);
48
    });
49
    it("blockAlign should be 8",
50
            function() {
51
        assert.equal(wav.blockAlign, 8);
52
    });
53
    it("bitsPerSample should be 64",
54
            function() {
55
        assert.equal(wav.bitsPerSample, 64);
56
    });
57
    it("subChunk2Id should be 'data'",
58
            function() {
59
        assert.equal(wav.subChunk2Id, 'data');
60
    });
61
    it("subChunk2Size should be > 0",
62
            function() {
63
        assert.ok(wav.subChunk2Size > 0);
64
    });
65
    it("samples.length should be > 0",
66
            function() {
67
        assert.ok(wav.samples_.length > 0);
68
    });
69
});
70